<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->

<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->

<!-- BEGIN HEAD -->

<head>
    <base href="/hxhmanage/"/>
    <meta charset="utf-8" />

    <title>好洗欢管理平台</title>

    <meta content="width=device-width, initial-scale=1.0" name="viewport" />

    <meta content="" name="description" />

    <meta content="" name="author" />

    <!-- BEGIN GLOBAL MANDATORY STYLES -->

    <link href="css/vendor/bootstrap.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/font-awesome.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style-metro.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style-responsive.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/default.css" rel="stylesheet" type="text/css" id="style_color"/>

    <link href="css/vendor/uniform.default.css" rel="stylesheet" type="text/css"/>

    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL STYLES -->

    <link rel="stylesheet" type="text/css" href="css/vendor/bootstrap-toggle-buttons.css" />

    <link rel="stylesheet" type="text/css" href="css/vendor/select2_metro.css" />

    <link rel="stylesheet" href="css/vendor/DT_bootstrap.css" />

    <link rel="stylesheet" href="css/vendor/bootstrap-modal.css" />

    <!-- END PAGE LEVEL STYLES -->

    <link rel="shortcut icon" href="images/logo.png" />

</head>
<body class="page-header-fixed page-sidebar-closed">
<!-- BEGIN HEADER -->

<div class="header navbar navbar-inverse navbar-fixed-top">

    <!-- BEGIN TOP NAVIGATION BAR -->

    <div class="navbar-inner">

        <div class="container-fluid">

            <!-- BEGIN LOGO -->

            <a class="brand" href="index.html" style="padding:0px;">

                <img src="images/logo.png" alt="logo" />

            </a>

            <!-- END LOGO -->

            <!-- BEGIN RESPONSIVE MENU TOGGLER -->

            <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">

                <img src="images/menu-toggler.png" alt="" />

            </a>

            <!-- END RESPONSIVE MENU TOGGLER -->

            <!-- BEGIN TOP NAVIGATION MENU -->



            <!-- END TOP NAVIGATION MENU -->

        </div>

    </div>

    <!-- END TOP NAVIGATION BAR -->

</div>
<!-- BEGIN CONTAINER -->

<div class="page-container row-fluid">

    <!-- BEGIN SIDEBAR -->

    <div class="page-sidebar nav-collapse collapse">

        <!-- BEGIN SIDEBAR MENU -->

        <ul class="page-sidebar-menu">

            <li>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

                <div class="sidebar-toggler hidden-phone"></div>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

            </li>



            <li>

                <a href="indexAction!setStrutsPage.action?pageFlag=order/ordermana.html">

                    <i class="icon-file-text"></i>

                    <span class="title">订单管理</span>

                </a>

            </li>

            <li class="active">

                <a href="indexAction!setStrutsPage.action?pageFlag=community/communityList.html">

                    <i class="icon-file-text"></i>

                    <span class="title">地址管理</span>

                </a>

            </li>


            <li >

                <a href="indexAction!setStrutsPage.action?pageFlag=diser/disermana.html">

                    <i class="icon-file-text"></i>

                    <span class="title">配送人员管理</span>

                </a>

            </li>


        </ul>

        <!-- END SIDEBAR MENU -->

    </div>

    <!-- END SIDEBAR -->

    <!-- BEGIN PAGE -->

    <div class="page-content">

        <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        <div id="portlet-config" class="modal hide">

            <div class="modal-header">

                <button data-dismiss="modal" class="close" type="button"></button>

                <h3>portlet Settings</h3>

            </div>

            <div class="modal-body">

                <p>Here will be a configuration form</p>

            </div>

        </div>

        <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        <!-- BEGIN PAGE CONTAINER-->

        <div class="container-fluid">

            <!-- BEGIN PAGE HEADER-->

            <div class="row-fluid">

                <div class="span12">


                </div>

            </div>

            <!-- END PAGE HEADER-->

            <!-- BEGIN PAGE CONTENT-->

            <div class="row-fluid">

                <div class="span12">

                    <!-- BEGIN EXAMPLE TABLE PORTLET-->

                    <div class="portlet box light-grey">

                        <div class="portlet-title">

                            <div class="caption"><i class="icon-globe"></i>小区明细</div>

                            <div class="tools">

                                <a href="javascript:;" class="collapse"></a>

                                <!--<a href="#portlet-config" data-toggle="modal" class="config"></a>-->

                                <!--<a href="javascript:;" class="reload"></a>-->

                                <!--<a href="javascript:;" class="remove"></a>-->

                            </div>

                        </div>

                        <div class="portlet-body form">

                            <div class="clearfix">
                                <div class="control-group span12">
                                    <label class="control-label">小区栋单元</label>
                                    <div class="controls">

                                        <input type="text" id="commDesc" class="span12 m-wrap" tabindex="1"/>

                                    </div>

                                </div>
                            </div>

                            <div class="control-group">
                                <button id="searchBtn" class="btn blue btn-block">搜索 <i class="m-icon-swapright m-icon-white"></i></button>
                            </div>

                            <div class="btn-group" style="font-size: 15px;">

                                <a class="btn blue" data-toggle="modal" id="editCommDetailDIV">添加 <i class="icon-plus"></i></a>

                                <button id="freshBtn" class="btn red">

                                    刷新 <i class="icon-refresh"></i>

                                </button>

                                <a class="btn green" data-toggle="modal" id="back">返回 <i class="icon-circle-arrow-left"></i></a>

                            </div>


                            <table class="table table-striped table-bordered table-hover" id="sample_1">

                                <thead>

                                <tr>

                                    <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 div span .checkboxes" /></th>

                                    <th class="hidden-480">小区栋单元</th>
                                    <!--<th class="hidden-480">明细状态</th>-->
                                    <th class="hidden-480">操作</th>

                                </tr>

                                </thead>

                            </table>

                        </div>

                    </div>

                    <!-- END EXAMPLE TABLE PORTLET-->

                </div>

            </div>



            <!-- END PAGE CONTENT-->

        </div>

        <!-- END PAGE CONTAINER-->

    </div>

    <!-- END PAGE -->

</div>

<!-- BEGIN FOOTER -->

<div class="footer">

    <div class="footer-inner">



    </div>

    <div class="footer-tools">

			<span class="go-top">

			<i class="icon-angle-up"></i>

			</span>

    </div>

</div>

<div id="editCommDetail" class="modal hide fade" tabindex="-1" data-width="760" data-backdrop="static">

    <form id="commDetailForm" class="form-horizontal">

        <input type="hidden" id="commId" name="commId">

        <input type="hidden" name="commDetailId">

        <div class="modal-header">

            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

            <h3>添加小区明细</h3>

        </div>

        <div class="modal-body">


            <div class="control-group">

                <label class="control-label">小区名称</label>

                <div class="controls">

                    <span id="commName" class="text"></span>

                </div>

            </div>

            <div class="control-group">

                <label class="control-label">小区栋单元<span class="required">*</span></label>

                <div class="controls">

                    <input name="commDesc" type="text" class="m-wrap medium" />

                </div>

            </div>

            <!--<div class="control-group">-->

                <!--<label class="control-label">明细状态</label>-->

                <!--<div class="controls">-->

                    <!--<div id="commStatus" class="basic-toggle-button">-->

                        <!--<input type="checkbox" class="toggle" checked="checked"/>-->

                    <!--</div>-->
                <!--</div>-->

            <!--</div>-->

            <!--<input type="hidden" name="commStatus" isCheckbox="true" value="1"/>-->

        </div>

        <div class="modal-footer">

            <button type="button" data-dismiss="modal" class="btn">关闭</button>

            <button id="editCommDetailBtn" type="button" class="btn blue">保存</button>

        </div>

    </form>

</div>

<!-- END FOOTER -->

<!-- END CONTAINER -->


<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

<!-- BEGIN CORE PLUGINS -->

<script src="js/vendor/jquery-1.10.1.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>

<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

<script src="js/vendor/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>

<script src="js/vendor/bootstrap.min.js" type="text/javascript"></script>

<!--[if lt IE 9]>

<script src="js/vendor/excanvas.min.js"></script>

<script src="js/vendor/respond.min.js"></script>

<![endif]-->

<script src="js/vendor/jquery.slimscroll.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.blockui.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.cookie.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.uniform.min.js" type="text/javascript" ></script>

<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL PLUGINS -->

<script type="text/javascript" src="js/vendor/jquery.toggle.buttons.js"></script>

<script type="text/javascript" src="js/vendor/jquery.validate.min.js"></script>

<script type="text/javascript" src="js/vendor/additional-methods.min.js"></script>

<script type="text/javascript" src="js/vendor/select2.min.js"></script>

<script type="text/javascript" src="js/vendor/chosen.jquery.min.js"></script>

<script type="text/javascript" src="js/vendor/jquery.dataTables.js"></script>

<script type="text/javascript" src="js/vendor/DT_bootstrap.js"></script>

<script type="text/javascript" src="js/vendor/bootstrap-modal.js"></script>

<script type="text/javascript" src="js/vendor/bootstrap-modalmanager.js"></script>

<script type="text/javascript" src="js/vendor/fnReloadAjax.js"></script>

<!-- END PAGE LEVEL PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="js/vendor/app.js"></script>

<script src="community/js/commDetail.js"></script>

<script src="js/common/common.js"></script>

<script>

    $("#back").on("click",function (){
        window.location.href = "indexAction!setStrutsPage.action?pageFlag=community/communityList.html";
    });

    function delCommDetail (commDetailId) {
        $.ajax({
            type: "POST",
            url:"commDetailAction!deleteCommDetail.action",
            data:{"commDetailId":commDetailId},
            dataType:"json",
            error: function(request) {
                createAlertMsgMainWin("删除失败");
            },
            success: function(data) {
                if (data.resultCode==1) {
                    createAlertMsgMainWin("删除成功");

//                    TableManaged._table.fnReloadAjax();
                    refreshTable(TableManaged._table);
                } else {
                    createAlertMsgMainWin("删除失败");
                }
            }
        });
    }

    $("#editCommDetailDIV").on("click",function () {

        $("#commDetailForm .modal-header h3").html("添加小区明细");
        var exculde = new Array();
        exculde["commId"] = true;
//        exculde["commStatus"] = true;
        clearData("commDetailForm",exculde);
        $("#commDetailForm *").removeClass('error').removeClass('success');
        $("#commDetailForm").validate().resetForm();
        $("#editCommDetail").modal('show');

        $("#editCommDetailBtn").unbind('click').on("click",function (){

            if (!$("#commDetailForm").valid()) {
                return ;
            }

            $.ajax({
                type: "POST",
                url:"commDetailAction!addCommDetail.action",
                data:$('#commDetailForm').serialize(),
                dataType:"json",
                error: function(request) {
                    createAlertMsgMainWin("添加失败");
                },
                success: function(data) {
                    if (data.resultCode==1) {
                        $("#editCommDetail").modal('hide');
                        createAlertMsgMainWin("添加成功");
//                        TableManaged._table.fnReloadAjax();
                        refreshTable(TableManaged._table);
                    } else {
                        createAlertMsgMainWin("添加失败");
                    }
                }
            });
        });
    });

    function updateCommDetail () {

        oTable = $('#sample_1').dataTable();
        oTable.$('tr').unbind('click').click(function () {
            oTable.$('tr').unbind('click');
            var data = oTable.fnGetData(this);
            loadData("commDetailForm",data);
            $("#commDetailForm .modal-header h3").html("修改小区明细");
            $("#commDetailForm *").removeClass('error').removeClass('success');
            $("#commDetailForm").validate().resetForm();
            $("#editCommDetail").modal("show");

            $("#editCommDetailBtn").unbind('click').on("click",function (){

                if (!$("#commDetailForm").valid()) {
                    return ;
                }

                $.ajax({
                    type: "POST",
                    url:"commDetailAction!updateCommDetail.action",
                    data:$('#commDetailForm').serialize(),
                    dataType:"json",
                    error: function(request) {
                        createAlertMsgMainWin("修改失败");
                    },
                    success: function(data) {
                        if (data.resultCode==1) {
                            $("#editCommDetail").modal('hide');
                            createAlertMsgMainWin("修改成功");

//                            TableManaged._table.fnReloadAjax();
                            refreshTable(TableManaged._table);
                        } else {
                            createAlertMsgMainWin("修改失败");
                        }
                    }
                });
            });
        });
    }

    jQuery(document).ready(function() {

        App.init();

//        $('#commStatus').toggleButtons({
//            onChange:function (){
//                if ($('#commStatus').toggleButtons("status")) {
//                    $("input[name=commStatus]").val(1);
//                } else {
//                    $("input[name=commStatus]").val(2);
//                }
//            },
//            label:{
//                enabled: "启用",
//                disabled: "停用"
//            },
//            style: {
//                enabled: "success",
//                disabled: ""
//            }
//        });

        var commId = sessionStorage.getItem("commId");

        $("#commId").val(commId);

        $.ajax({
            type: "POST",
            url:"communityAction!getCommunity.action",
            data:{"commId":commId},
            dataType:"json",
            success: function(data) {
                if (data.resultCode==1) {
                    $(".caption").html('<i class="icon-globe"></i>'+data.province+'-'+data.city+'-'+data.district+'-'+data.commName+' 小区明细');
                    $("#commName").html(data.commName);
                }
            }
        });

        TableManaged.init(commId);

        FormValidation.init();

        $("#freshBtn").on("click",function(){
            refreshTable(TableManaged._table);
//            TableManaged._table.fnReloadAjax();
        });

        $("#searchBtn").on("click",function (){
            TableManaged.init(commId,$("#commDesc").val());
        });

    });

</script>
</body>
</html>